/*******************************************************************************
 * Copyright:   Copyright (c) 2007. Hisilicon Technologies, CO., LTD.
 * Version:     V300R001B03
 * Filename:    csr_fm_reg.h
 * Description: Header file for csr fm register define.
 * History:
                1.Created by SunShaojie on 2007/09/15
*******************************************************************************/

#ifndef _CSR_FM_REG_H
#define _CSR_FM_REG_H


//FLAG Register
#define FM_ENABLE_BITPOS  0
#define FM_STATUS_ENABLE_SET        (0x01 << FM_ENABLE_BITPOS)





// FLAG register
#define FM_INTSTATUS_FLFR_BITPOS    0
#define FM_IS_INTSTATUS_FLFR        (0x1 << FM_INTSTATUS_FLFR_BITPOS)
                                    
#define FM_INTSTATUS_FLBL_BITPOS    1
#define FM_IS_INTSTATUS_FLBL        (0x1 << FM_INTSTATUS_FLBL_BITPOS)
                                    
#define FM_INTSTATUS_FLIF_BITPOS    2
#define FM_IS_INTSTATUS_FLIF        (0x1 << FM_INTSTATUS_FLIF_BITPOS)
                                    
#define FM_INTSTATUS_FLLVL_BITPOS   3
#define FM_IS_INTSTATUS_FLLVL       (0x1 << FM_INTSTATUS_FLLVL_BITPOS)
                                    
#define FM_INTSTATUS_FLSYN_BITPOS   4
#define FM_IS_INTSTATUS_FLSYN       (0x1 << FM_INTSTATUS_FLSYN_BITPOS)
                                    
#define FM_INTSTATUS_FLRDS_BITPOS   5
#define FM_IS_INTSTATUS_FLRDS       (0x1 << FM_INTSTATUS_FLRDS_BITPOS)
                                    
#define FM_INTSTATUS_FLBB_BITPOS    6
#define FM_IS_INTSTATUS_FLBB        (0x1 << FM_INTSTATUS_FLBB_BITPOS)
                                    
#define FM_INTSTATUS_FLPI_BITPOS    7
#define FM_IS_INTSTATUS_FLPI        (0x1 << FM_INTSTATUS_FLPI_BITPOS)

#define FM_INTSTATUS_FLPD_BITPOS    0
#define FM_IS_INTSTATUS_FLPD        (0x1 << FM_INTSTATUS_FLPD_BITPOS)
                                    
#define FM_INTSTATUS_FLSTR_BITPOS   1
#define FM_IS_INTSTATUS_FLSTR       (0x1 << FM_INTSTATUS_FLSTR_BITPOS)

#define FM_INTSTATUS_FLRST_BITPOS   7
#define FM_IS_INTSTATUS_FLRST       (0x1 << FM_INTSTATUS_FLRST_BITPOS)


// STATUS register
#define FM_STATUS_TS_BITPOS         0
#define FM_STATUS_TS_BITWIDTH       3
#define FM_STATUS_TS_BITMASK        (((1<<FM_STATUS_TS_BITWIDTH)-1)<<FM_STATUS_TS_BITPOS)
#define FM_TS_NOT_POWER_UP          (0<<FM_STATUS_TS_BITPOS)
#define FM_TS_NOT_VALID_FRE         (1<<FM_STATUS_TS_BITPOS)
#define FM_TS_TURN_IN_PROCESS       (2<<FM_STATUS_TS_BITPOS)
#define FM_TS_RDS_POWER_DOWN        (3<<FM_STATUS_TS_BITPOS)
#define FM_TS_RDS_NO_PRESENT        (4<<FM_STATUS_TS_BITPOS)
#define FM_TS_RDS_NOT_SYN           (5<<FM_STATUS_TS_BITPOS)
#define FM_TS_RDS_IS_RECEIVED       (6<<FM_STATUS_TS_BITPOS)

#define FM_STATUS_RDA_BITPOS        3
#define FM_IS_STATUS_RDA            (0x1 << FM_STATUS_RDA_BITPOS)

#define FM_STATUS_STR_BITPOS        4
#define FM_IS_STATUS_STR            (0x1 << FM_STATUS_STR_BITPOS)

#define FM_STATUS_IFR_BITPOS        5
#define FM_IS_STATUS_IFR            (0x1 << FM_STATUS_IFR_BITPOS)

#define FM_STATUS_RSR_BITPOS        6
#define FM_IS_STATUS_RSR            (0x1 << FM_STATUS_RSR_BITPOS)

// SEARCH DIRECTION register
#define FM_SEARCH_SRD_BITPOS        0
#define FM_SEARCH_SRD_BITWIDTH      1
#define FM_SEARCH_SRD_BITMASK       (((1<<FM_SEARCH_SRD_BITWIDTH)-1)<<FM_SEARCH_SRD_BITPOS)
#define FM_IS_SEARCH_UP             (0<<FM_SEARCH_SRD_BITPOS)
#define FM_IS_SEARCH_DOWN           (1<<FM_SEARCH_SRD_BITPOS)

// TURN MODE register
#define FM_TURN_TM_BITPOS           0
#define FM_TURN_TM_BITWIDTH         2
#define FM_TURN_TM_BITMASK          (((1<<FM_TURN_TM_BITWIDTH)-1)<<FM_TURN_TM_BITPOS)
#define FM_IS_CANCLE_TURN           (0<<FM_TURN_TM_BITPOS)
#define FM_IS_PRESET_TURN           (1<<FM_TURN_TM_BITPOS)
#define FM_IS_SEARCH_MODE           (2<<FM_TURN_TM_BITPOS)
#define FM_IS_JUMP_TURN             (3<<FM_TURN_TM_BITPOS)

#define FM_TURN_FSD_BITPOS          4
#define FM_TURN_FSD_BITWIDTH        1
#define FM_TURN_FSD_BITMASK         (((1<<FM_TURN_FSD_BITWIDTH)-1)<<FM_TURN_FSD_BITPOS)
#define FM_IS_SDR_BY_SDR            (0<<FM_TURN_FSD_BITPOS)
#define FM_IS_SDR_BY_FDD            (1<<FM_TURN_FSD_BITPOS)

#define FM_TURN_FDD_BITPOS          5
#define FM_TURN_FDD_BITWIDTH        1
#define FM_TURN_FDD_BITMASK         (((1<<FM_TURN_FDD_BITWIDTH)-1)<<FM_TURN_FDD_BITPOS)
#define FM_IS_FDD_UP                (0<<FM_TURN_FDD_BITPOS)
#define FM_IS_FDD_DOWN              (1<<FM_TURN_FDD_BITPOS)

#define FM_TURN_SKP_BITPOS          6
#define FM_TURN_SKP_BITWIDTH        1
#define FM_TURN_SKP_BITMASK         (((1<<FM_TURN_SKP_BITWIDTH)-1)<<FM_TURN_SKP_BITPOS)
#define FM_IS_CHK_FREQ              (0<<FM_TURN_SKP_BITPOS)
#define FM_IS_SKIP_FREQ             (1<<FM_TURN_SKP_BITPOS)

//MUTE STATUS register
#define FM_MUTESTATE_MSS_BITPOS     0
#define FM_IS_MSS_ENABLE            (0x1 << FM_MUTESTATE_MSS_BITPOS)

#define FM_MUTESTATE_MSA_BITPOS     1
#define FM_IS_MSA_ENABLE            (0x1 << FM_MUTESTATE_MSA_BITPOS)

#define FM_MUTESTATE_MSL_BITPOS     2
#define FM_IS_MSL_ENABLE            (0x1 << FM_MUTESTATE_MSL_BITPOS)

#define FM_MUTESTATE_MSR_BITPOS     3
#define FM_IS_MSR_ENABLE            (0x1 << FM_MUTESTATE_MSR_BITPOS)

// MOST MODE register
#define FM_MOST_MODE_STM_BITPOS     0
#define FM_MOST_MODE_STM_BITWIDTH   1
#define FM_MOST_MODE_STM_BITMASK    (((1<<FM_MOST_MODE_STM_BITWIDTH)-1)<<FM_MOST_MODE_STM_BITPOS)
#define FM_IS_FORCE_MONO            (0<<FM_MOST_MODE_STM_BITPOS)
#define FM_IS_AUTO_STEREO           (1<<FM_MOST_MODE_STM_BITPOS)

// MOST BLEND register
#define FM_MOST_BLEND_STB_BITPOS    0
#define FM_MOST_BLEND_STB_BITWIDTH  1
#define FM_MOST_BLEND_STB_BITMASK   (((1<<FM_MOST_BLEND_STB_BITWIDTH)-1)<<FM_MOST_BLEND_STB_BITPOS)
#define FM_IS_SOFT_BLEND            (0<<FM_MOST_BLEND_STB_BITPOS)
#define FM_IS_SWITCH_BLEND          (1<<FM_MOST_BLEND_STB_BITPOS)

// BAND register
#define FM_BAND_BND_BITPOS          0
#define FM_BAND_BND_BITWIDTH        1
#define FM_BAND_BND_BITMASK         (((1<<FM_BAND_BND_BITWIDTH)-1)<<FM_BAND_BND_BITPOS)
#define FM_IS_EUROPEAN_BAND         (0<<FM_BAND_BND_BITPOS)
#define FM_IS_JAPANESE_BAND         (1<<FM_BAND_BND_BITPOS)

// DEMTH MODE register
#define FM_DEMPH_DMF_BITPOS         0
#define FM_DEMPH_DMF_BITWIDTH       1
#define FM_DEMPH_DMF_BITMASK        (((1<<FM_DEMPH_DMF_BITWIDTH)-1)<<FM_DEMPH_DMF_BITPOS)
#define FM_IS_50US_EMPHASIS         (0<<FM_DEMPH_DMF_BITPOS)
#define FM_IS_75US_EMPHASIS         (1<<FM_DEMPH_DMF_BITPOS)

// RDS SYSTEM register
#define FM_RDS_SYS_RDS_BITPOS       0
#define FM_RDS_SYS_RDS_BITWIDTH     1
#define FM_RDS_SYS_RDS_BITMASK      (((1<<FM_RDS_SYS_RDS_BITWIDTH)-1)<<FM_RDS_SYS_RDS_BITPOS)
#define FM_IS_USE_RDS               (0<<FM_RDS_SYS_RDS_BITPOS)
#define FM_IS_USE_RBDS              (1<<FM_RDS_SYS_RDS_BITPOS)

#define FM_RDS_SYS_NEB_BITPOS       1
#define FM_RDS_SYS_NEB_BITWIDTH     1
#define FM_RDS_SYS_NEB_BITMASK      (((1<<FM_RDS_SYS_NEB_BITWIDTH)-1)<<FM_RDS_SYS_NEB_BITPOS)
#define FM_IS_STORE_E_BLOCKS        (0<<FM_RDS_SYS_NEB_BITPOS)
#define FM_IS_NOTSTORE_E_BLOCKS     (1<<FM_RDS_SYS_NEB_BITPOS)

// POWER register
#define FM_POWER_FM_BITPOS          0
#define FM_IS_FM_POWERUP            (0x1 << FM_POWER_FM_BITPOS)

#define FM_POWER_RDS_BITPOS         1
#define FM_IS_RDS_POWERUP           (0x1 << FM_POWER_RDS_BITPOS)

// RDS CNTR register
#define FM_RDS_FLS_BITPOS           0
#define FM_IS_FLUSH_RDS             (0x1 << FM_RDS_FLS_BITPOS)

#define FM_RDS_UNS_BITPOS           1
#define FM_IS_RE_SYNC_RDS           (0x1 << FM_RDS_UNS_BITPOS)


// FM register define

typedef volatile struct
{   
    UINT8  CHIP_ID_H;           //00H
    UINT8  CHIP_ID_L;
	UINT8  CHIP_ID_RESERVE_H;   //01H
	UINT8  CHIP_ID_RESERVE_L;
    UINT8  SET_ENABLE_MODE_H;   //02H
	UINT8  SET_ENABLE_MODE_L;
    UINT8  SET_BAND_SPACE_H;    //03H
	UINT8  SET_BAND_SPACE_L;
    UINT8  SET_GPIO_I2S_H;      //04H
	UINT8  SET_GPIO_I2S_L;
    UINT8  SET_VOLUME_INT_H;    //05H
	UINT8  SET_VOLUME_INT_L;
	UINT8  SET_REG_UNLOCK_H;     //06H
	UINT8  SET_REG_UNLOCK_L;
  	
} WRITE_FM_REG, *PWRITE_FM_REG;

typedef volatile struct
{
    UINT8  GET_CHANNEL_SEEK_H;   //0AH
	UINT8  GET_CHANNEL_SEEK_L;
    UINT8  GET_RSSI_FMSTATUS_H;  //0BH
	UINT8  GET_RSSI_FMSTATUS_L;
	UINT8  GET_RDA_TYPE_ID_H;    //0CH
	UINT8  GET_RDA_TYPE_ID_L;

} READ_FM_REG, *PREAD_FM_REG;




#endif

